# Makefile for MudGUI

include ../common.mk

INCDIRS := ../$(INCDIR)

SRCS := $(wildcard *.bas)

OBJS := $(SRCS:%.bas=%$(EXE_EXT))

LIBNAME := mudgui

LIBRARY := ../$(LIBDIR)/lib$(LIBNAME).a

FBC_CFLAGS += -w all -i $(INCDIRS)
FBC_LFLAGS += -p ../$(LIBDIR)

ifndef NDEBUG
	FBC_CFLAGS += -g
endif

ifdef PROFILE
	FBC_CFLAGS += -profile
endif

ifdef EXX
	FBC_CFLAGS += -exx
endif

ifdef OPT
	FBC_CFLAGS += $(OPT)
endif

# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  targets
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

all : $(OBJS)


# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  rules
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

$(LIBRARY) : $(OBJS)
	test -e $(LIBDIR) || $(MD) -p $(LIBDIR)
	$(FBC) -lib -x $(LIBDIR)/$(LIBNAME) $(FBC_CFLAGS) $(OBJS)

%$(EXE_EXT) : %.bas
	$(FBC) $(FBC_CFLAGS) $(FBC_LFLAGS) $< -x $@

# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  clean
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

.PHONY : clean
clean : 
	@echo Removing Examples..
	$(RM) -f $(OBJS)



